package com.itlaoqi.springcloud.messageservice.controller;

import com.itlaoqi.springcloud.messageservice.entity.CallbackResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

@RestController
public class MessageController {
    /**
     * 模拟发送短信
     * @param mobile 手机号
     * @param message 发送内容
     * @return 处理标示
     */
    @GetMapping("/sendsms")
    private CallbackResult sendSms(String mobile, String message ){
        int seconds = new Random().nextInt(3000);
        try {
            Thread.sleep(seconds);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return new CallbackResult("0", "SUCCESS");
    }
}
